.386
.model flat, stdcall
option casemap :none

	include	\masm32\include\windows.inc
	include \masm32\include\kernel32.inc
	include \masm32\include\user32.inc

	includelib \masm32\lib\kernel32.lib
	includelib \masm32\lib\user32.lib

	DialogProc proto :DWORD, :DWORD, :DWORD, :DWORD

.data
dlgTemplate	db 040h,008h,0C8h,010h,000h,000h,000h,000h,002h,000h,000h,000h,000h,000h,0DDh,000h
		db 07Fh,000h,000h,000h,000h,000h,01Fh,004h,040h,004h,03Eh,004h,041h,004h,042h,004h
		db 03Eh,004h,035h,004h,020h,000h,038h,004h,041h,004h,03Fh,004h,03Eh,004h,03Bh,004h
		db 04Ch,004h,037h,004h,03Eh,004h,032h,004h,030h,004h,03Dh,004h,038h,004h,035h,004h
		db 020h,000h,048h,004h,030h,004h,031h,004h,03Bh,004h,03Eh,004h,03Dh,004h,030h,004h
		db 000h,000h,008h,000h,04Dh,000h,053h,000h,020h,000h,053h,000h,061h,000h,06Eh,000h
		db 073h,000h,020h,000h,053h,000h,065h,000h,072h,000h,069h,000h,066h,000h,000h,000h
		db 000h,000h,001h,050h,000h,000h,000h,000h,032h,000h,028h,000h,082h,000h,016h,000h
		db 0EAh,003h,0FFh,0FFh,082h,000h,02Dh,004h,03Bh,004h,035h,004h,03Ch,004h,035h,004h
		db 03Dh,004h,042h,004h,020h,000h,043h,004h,03Fh,004h,040h,004h,030h,004h,032h,004h
		db 03Bh,004h,035h,004h,03Dh,004h,038h,004h,04Fh,004h,020h,000h,053h,000h,054h,000h
		db 041h,000h,054h,000h,049h,000h,043h,000h,000h,000h,000h,000h,000h,000h,001h,050h
		db 000h,000h,000h,000h,049h,000h,050h,000h,04Ah,000h,016h,000h,0EBh,003h,0FFh,0FFh
		db 080h,000h,01Ah,004h,03Dh,004h,03Eh,004h,03Fh,004h,03Ah,004h,030h,004h,000h,000h
		db 000h,000h,000h,000h

.data?
hInstance   HINSTANCE ?
CommandLine LPSTR ?

.code
start:

invoke	GetModuleHandle, NULL
mov	hInstance, eax
invoke	GetCommandLine
mov	CommandLine, eax

; создаем окно диалога
invoke	DialogBoxIndirectParam, hInstance, addr dlgTemplate, NULL, addr DialogProc, 0

; стандартный выход
invoke	ExitProcess, eax

DialogProc proc hDlg:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
	.if uMsg == WM_INITDIALOG
	.elseif uMsg == WM_COMMAND
		.if wParam == 1003	; реакция на нажатие кнопки
			invoke SendMessage, hDlg, WM_CLOSE, 0, 0
		.endif
	.elseif uMsg == WM_CLOSE
		invoke EndDialog, hDlg, 0
		ret
	.endif
	xor	eax, eax
	ret
DialogProc endp

end start
